<?php
defined('_JEXEC') or die ('restricted access');
jimport('joomla.application.component.controller');
class BlogController extends JController
{
   function display ()
   {
      //get a refrence of the page instance in joomla
      $document=& JFactory::getDocument();
      //get the view name from the query string
      $viewName = JRequest::getVar('view', 'posts');

      $viewType= $document->getType();
      //get our view
      $view = &$this->getView($viewName, $viewType);
      //get the model
      $model = &$this->getModel($viewName, 'BlogModel');
      //some error chec
      if (!JError::isError($model))
      {
         $view->setModel ($model, true);
      }
      //set the template and display it
      $view->setLayout('default');
      $view->display();
	
   }
}
?>